package com.mysoft.gfyx.clue.service;


import com.mysoft.gfyx.clue.controller.dto.DeleteCustomerRequestDto;
import com.mysoft.framework.modeling.dto.FieldsSetting;
import com.mysoft.framework.modeling.dto.ListDataResult;
import com.mysoft.framework.modeling.dto.LoadDataParams;
import com.mysoft.gfyx.clue.controller.dto.EditCustomerRequestDto;
import com.mysoft.gfyx.clue.controller.dto.PubAddCustomersRequestDto;
import com.mysoft.gfyx.clue.dao.dto.CustomerRequestDto;
import com.mysoft.gfyx.clue.dao.dto.RegionCustomerRequestDto;
import com.mysoft.gfyx.clue.dao.entity.Customer;
import com.mysoft.gfyx.clue.service.dto.CustomerContactDto;
import com.mysoft.gfyx.clue.service.dto.CustomerDto;
import com.mysoft.gfyx.common.dto.TotalDto;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.util.*;

/**
 * 描述：Customer 接口层
 *
 * @author JavaSdk generator
 * @date 2022-07-07
 */
@Service
public interface CustomerService {
    int COOPERATION_STATUS_NEVER = 0; // 未合作
    int COOPERATION_STATUS_KNOWN = 1; // 已合作
    int COOPERATION_STATUS_STOCK = 2; // 已入库

    Integer BATCH_ADD = 1;//批量添加
    Integer Single_ADD = 0;//单个添加

    String ACTION_CUSTOMER = "customer";//添加客户
    String ACTION_CUSTOMER_POOL = "customerPool";//添加客户池

    String OPERATION_EDIT = "edit";//编辑
    String OPERATION_ADD = "add";//新增

    /**
     * 通过主键查询数据
     *
     * @param id 主键
     * @return 数据
     */
    CustomerDto selectById(String id);

    //刷新客户联系人数
    boolean flushContacterCount();

    int getMyCustomerCount();

    // 我的客户
    FieldsSetting loadCustomerListFields();
    ListDataResult findCustomerList(LoadDataParams params);
    TotalDto getCustomerListTotal(CustomerRequestDto dto);

    // 区域客户
    FieldsSetting loadRegionCustomerListFields();
    ListDataResult findRegionCustomerList(LoadDataParams params);
    TotalDto getRegionCustomerListTotal(RegionCustomerRequestDto dto);

    /**
     * 获取一个客户
     *
     * @param conditions
     * @return
     */
    CustomerDto getCustomer(Map<String, Object> conditions);

    Customer addCustomer(CustomerDto customerDto);

    boolean addCustomers(Collection<CustomerDto> customersDto);

    boolean batchCustomersAndHistory(PubAddCustomersRequestDto pubAddCustomersDto);

    boolean addCustomerAndPool(PubAddCustomersRequestDto pubAddCustomersDto);

    boolean editCustomerAndPool(EditCustomerRequestDto editCustomersDto);

    void deleteCustomer(DeleteCustomerRequestDto dto);

    public boolean sendSiteMessage(UUID batchId, ArrayList<CustomerContactDto> contactList);

    CustomerDto getCustomerWithUnique(UUID CustomerResponsiblePersonGUID, String CreditCode);

    Set<String> isAdded(List<String> creditCodes);

    List<Map<String,Object>> exportCustomer(LoadDataParams options);

    List<Map<String,Object>> exportRegionCustomer(LoadDataParams options);

    List<String> importCustomerPool(String path) throws IOException;
}

